<%--
    Document   : template
    Created on : Mar 24, 2011, 5:16:47 PM
    Author     : Javier Snaider
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>


<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><bean:message key="welcome.title"/></title>
        <link rel="stylesheet" href="${pageContext.servletContext.contextPath}/css/template_css.css" media="screen"
              type="text/css" />
        <html:base/>
        <!-- calendar stylesheet -->
        <link rel="stylesheet" type="text/css" media="all" href="${pageContext.servletContext.contextPath}/js/calendar-win2k-cold-1.css" title="win2k-cold-1" />

        <!-- main calendar program -->
        <script type="text/javascript" src="${pageContext.servletContext.contextPath}/js/calendar.js"></script>

        <!-- language for the calendar -->
        <script type="text/javascript" src="${pageContext.servletContext.contextPath}/js/lang/calendar-en.js"></script>

        <!-- the following script defines the Calendar.setup helper function, which makes
             adding a calendar a matter of 1 or 2 lines of code. -->
        <script type="text/javascript" src="${pageContext.servletContext.contextPath}/js/calendar-setup.js"></script>


    </head>
    <body>
        <div class="container">
            <div class="header">
                <a href="#"><img src="${pageContext.servletContext.contextPath}/img/grlg.png" alt="Insert_logo" name="Insert_logo" width="180" height="90" id="Insert_logo" style="background: #C6D580; display:block;"></a>
            </div><!-- end .header -->
            <div class="content">
                <div align="right"> <html:link page="/views/menu.jsp">Home</html:link>&nbsp;&nbsp;<br/><br/></div>

                <html:form action="/SalesReport" method="post">
                    <table border="0">
                        <tr>
                            <td>&nbsp;&nbsp;</td>
                            <td align="center"><font color="red"><html:errors property="report" /></font></td>
                        </tr>
                    </table>
                    From:
                    <html:text styleId="startDateString" property="startDateString"   size="20"  />
                    <img alt="cal"  src="${pageContext.servletContext.contextPath}/js/imgcal.gif" id="f_trigger_a" style="cursor: pointer; border: 1px solid red;" title="Date selector"
                         onmouseover="this.style.background='red';" onmouseout="this.style.background=''" />
                    &nbsp;&nbsp;&nbsp;

                    To:

                    <html:text styleId="endDateString" property="endDateString"   size="20"  />

                    <img alt="cal"  src="${pageContext.servletContext.contextPath}/js/imgcal.gif" id="f_trigger_b" style="cursor: pointer; border: 1px solid red;" title="Date selector"
                         onmouseover="this.style.background='red';" onmouseout="this.style.background=''" />
                    <br/>
                    <html:submit value="Show" />
                    <html:link action="cancelCheckout">Cancel</html:link>
                </html:form>

                <b> Sales Report :</b>


                <hr/>

                <div style="height:230px;overflow:auto;">
                    <table border="1">
                        <thead>
                            <tr>
                                <th>No.</th>
                                <th>ID</th>
                                <th>Date</th>
                                <th>SubTotal</th>
                                <th>Tax</th>
                                <th>Total</th>
                            </tr>
                        </thead>
                        <c:set var="i" value="${0}" />
                        <c:forEach var="t" items="${transactions}">
                            <tbody>
                                <tr>
                                    <c:set var="i" value="${i+1}" />
                                    <td style="text-align: right">${i}</td>
                                    <td style="text-align: right">${t.id}</td>
                                    <td style="text-align: right"><fmt:formatDate value="${t.saleDate}" pattern="MM/dd/yyyy" />
                                    </td>

                                    <td style="text-align: right"><fmt:formatNumber pattern="$###0.00">${t.subTotal}</fmt:formatNumber></td>
                                    <td style="text-align: right"><fmt:formatNumber pattern="$###0.00">${t.tax}</fmt:formatNumber></td>
                                    <td style="text-align: right"><fmt:formatNumber pattern="$###0.00">${t.total}</fmt:formatNumber></td>
                                </tr>
                            </tbody>
                        </c:forEach>
                        <tr>
                            <td colspan="3">&nbsp;</td>
                            <td style="text-align: right"><fmt:formatNumber pattern="$###0.00">${total_SubTotal}</fmt:formatNumber></td>
                            <td style="text-align: right"><fmt:formatNumber pattern="$###0.00">${total_Tax}</fmt:formatNumber></td>
                            <td style="text-align: right"><fmt:formatNumber pattern="$###0.00">${total_Total}</fmt:formatNumber></td>
                        </tr>


                    </table>
                </div>



                <!-- YOUR CODE HERE -->



            </div><!-- end .content -->
        </div><!-- end .container -->
        <div class="footer">
            <p>Copyright 2011&nbsp;TigerSoft</p>
        </div><!-- end .footer -->
        <script type="text/javascript">
            Calendar.setup({
                inputField     :    "startDateString",      // id of the input field
                ifFormat       :    "%m/%d/%Y",       // format of the input field
                button         :    "f_trigger_a",   // trigger for the calendar (button ID)
                step           :    1                // show all years in drop-down boxes (instead of every other year as default)
            });
        </script>
        <script type="text/javascript">
            Calendar.setup({
                inputField     :    "endDateString",      // id of the input field
                ifFormat       :    "%m/%d/%Y",       // format of the input field
                button         :    "f_trigger_b",   // trigger for the calendar (button ID)
                step           :    1                // show all years in drop-down boxes (instead of every other year as default)
            });
        </script>

    </body>
</html>